
local totalDamage = achievements.GetValue( "Punchbag", "total", 0 )
local function Hurt( damage )
	if ( totalDamage == 10000 ) then return end
	totalDamage = math.Clamp( totalDamage + damage, 0, 10000 )
	achievements.Update( "Punchbag", totalDamage / 10000, totalDamage .. "/10000" )
	achievements.SetValue( "Punchbag", "total", totalDamage )
end
local lastHealth
local function Check()
	local health = math.max( LocalPlayer():Health(), 0 )
	if ( health < ( lastHealth or 0 ) ) then
		Hurt( lastHealth - health )
	end
	lastHealth = health
end
timer.Create( "Achievements.Punchbag", 1, 0, Check )

achievements.Register( "Punchbag", "Take 10000 damage.", "achievements/punchbag", totalDamage / 10000, totalDamage .. "/10000" )
